package tuya;

import java.util.Scanner;

/**
 * @author xizizzz
 * @description: TODO
 * @date 2021-9-14下午 08:06
 */
public class Test1 {
    public static void main(String[] args) {
        final String s = new Scanner(System.in).nextLine();
        char tmp = s.charAt(0);
        String t = String.valueOf(tmp);
        final String s2 = s.substring(1, s.length());
        final String s1 = longestPalindrome(s2);
        System.out.print(t + s1 + t);

    }

    public static String longestPalindrome(String s) {
        //暴力匹配
        int len = s.length();
        if (len < 2) return s;
        int maxLen = 1;
        int begin = 0;
        char[] charArray = s.toCharArray();

        //枚举所有长度大于1的子串 charArray[i..j]
        for (int i = 0; i < len - 1; i++) {
            for (int j = i + 1; j < len; j++) {
                if (j - i + 1 > maxLen && validPalindromic(charArray, i, j)) {
                    maxLen = j - i + 1;
                    begin = i;
                }
            }
        }
        return s.substring(begin, begin + maxLen);
    }

    //验证子串是否为回文串
    public static boolean validPalindromic(char[] charArray, int left, int right) {
        while (left < right) {
            if (charArray[left] != charArray[right]) {
                return false;
            }
            left++;
            right--;
        }
        return true;
    }
}
